package day05;

import java.util.Scanner;

//随机加法运算器
public class Addition {
    public static void main(String[] args) {
        Scanner scanner =new Scanner(System.in);
        int score = 0;
        int sum=0;
        for(int times=1;times<=10;times++){
            int i=(int)(Math.random()*100+1);
            int j=(int)(Math.random()*100+1);
            System.out.println("("+times+")."+i+"+"+j+"=?"); //出题

            sum = i + j;
            int answer = scanner.nextInt();     //回答

            if(answer == sum ){
                System.out.println("答对了，加10分~~~~");
                score+=10;
            }
            else{
                System.out.println("答错了");      //判题
            }

        }
        System.out.println("总分为："+score);        //计算成绩
        if(score<60){
            System.out.println("不及格");
        }
    }
}
